﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <meta http-equiv="Cache" content="no-cache" />
    <title>Detail</title>
    <link rel="stylesheet" href="~/Scripts/ligerUI/skins/Aqua/css/ligerui-all.css" />
    <link rel="stylesheet" href="~/Scripts/ligerUI/skins/ligerui-icons.css" />
    <link rel="stylesheet" href="~/Scripts/ligerUI/skins/Gray/css/all.css" />
    <link rel="stylesheet" href="~/Content/css/common.css" />
    <script src="~/Scripts/jquery-1.10.2.min.js"  ></script>
    <script src="~/Scripts/ligerUI/js/ligerui.all.js"></script>
    <script src="~/Scripts/common.js?v=@DateTime.Now.ToString("yyyyMMdd")"></script>
    <link rel="stylesheet" href="~/Scripts/laydate/theme/default/laydate.css" />
    <script src="~/Scripts/laydate/laydate.js"></script>
</head>
<body>
    <div>
        <div id="maingrid"></div>
    </div>
    <script  >
        $(document).ready(function () {
            initTable();
        })
        var manager;
        function initTable() {
            var data = getDetailData();
            manager = $("#maingrid").ligerGrid({
                height: '100%',
                heightDiff: 25,
                data: data,
                usePager: false,
                frozen: false,
                enabledEdit: true,
                clickToEdit: false,
                columns:
                            [
                            { display: '诊疗内容', name: 'OrderID', width: 200 },
                            { display: '执行人', name: 'Freight', width: 60, editor: { type: 'text' } },
                            { display: '执行时间', name: 'ShipName', width: 150, editor: { type: 'date', showTime: true }, type: "date", format: "yyyy-MM-dd hh:mm:ss" },
                            { display: '延迟时间', name: 'yanchishijian', width: 100, editor: { type: 'text' } },
                            { display: '拒绝理由', name: 'jujueliyou', width: 100, editor: { type: 'text' } },
                            { display: '备注', name: 'ShipAddress', editor: { type: 'text' }  },
                            {
                                 display: '操作', name: '', width: 100, render: function (rowdata, rowindex, value) {
                                     var html = "";
                                     if (!rowdata._editing) {
                                         html += "<a href='javascript:beginEdit(" + rowindex + ")'>编辑</a> ";
                                     }
                                     else {
                                         html += "<a href='javascript:endEdit(" + rowindex + ")'>提交</a> ";
                                         html += "<a href='javascript:cancelEdit(" + rowindex + ")'>取消</a> ";
                                     }
                                     return html;
                                 }
                             }
                            ]
            });
        }
        //获取详情数据
        function getDetailData() {
            var data = {
                Rows: [{ "OrderID": "出心电图", "CustomerID": "VINET", "EmployeeID": 5, "OrderDate": new Date(775958400000), "RequiredDate": new Date(778377600000), "ShippedDate": new Date(776995200000), "ShipVia": 3, "Freight": "李医生", "ShipName": "2019-07-29 14:00", "ShipAddress": "心电图异常", "ShipCity": "Reims", "ShipRegion": null, "ShipPostalCode": "51100", "ShipCountry": "France","yanchishijian":"","jujueliyou":"" },
                       { "OrderID": "出导管室", "CustomerID": "TOMSP", "EmployeeID": 6, "OrderDate": new Date(776044800000), "RequiredDate": new Date(779673600000), "ShippedDate": new Date(776476800000), "ShipVia": 1, "Freight": "张雄安", "ShipName": "2019-07-29 15:00", "ShipAddress": "诊疗无误", "ShipCity": "Münster", "ShipRegion": null, "ShipPostalCode": "44087", "ShipCountry": "Germany", "yanchishijian": "", "jujueliyou": "" },
                       { "OrderID": "出急诊科", "CustomerID": "HANAR", "EmployeeID": 4, "OrderDate": new Date(776304000000), "RequiredDate": new Date(778723200000), "ShippedDate": new Date(776649600000), "ShipVia": 2, "Freight": "陈室", "ShipName": "2019-07-29 14:30", "ShipAddress": "已经出急诊科", "ShipCity": "Rio de Janeiro", "ShipRegion": "RJ", "ShipPostalCode": "05454-876", "ShipCountry": "Brazil", "yanchishijian": "", "jujueliyou": "" }]
            };
            return data;
        }

        function beginEdit(rowid) {
            for (var i = 0; i < manager.getData().length; i++) {
                if (i == rowid) {
                    manager.beginEdit(i);
                }
                else {
                    manager.cancelEdit(i);
                }
            }
        }
        function cancelEdit(rowid) {
            manager.cancelEdit(rowid);
        }
        function endEdit(rowid) {
            manager.endEdit(rowid);
        }
    </script>
</body>
</html>